package com.wumai.keystrokes.models.display;

import com.wumai.keystrokes.models.Position;

/**
 * @author  trick12138
 * @date  2025-08-20
 * @description 按键模型
 */
public class Key {
    public KeyType getKeyType() {
        return keyType;
    }

    public enum KeyType {
        KEYBOARD,
        MOUSE
    }

    private String name = "";
    private int keyCode = -1;
    private Position position = new Position();
    private float width = 0;
    private float height = 0;
    private TextureResource pressedResource = null;  // 按下时的资源
    private TextureResource releasedResource = null; // 抬起时的资源
    private KeyType keyType = KeyType.KEYBOARD;

    public Key(){}

    public Key(String name, int keyCode,
               Position position,
               float width, float height,
               TextureResource pressedResource,
               TextureResource releasedResource,
               KeyType keyType
    ) {
        this.name = name;
        this.keyCode = keyCode;
        this.position = position;
        this.pressedResource = pressedResource;
        this.releasedResource = releasedResource;
        this.keyType = keyType;
        this.width = width;
        this.height = height;
    }

    public Key(String name, int keyCode, Position position) {
        this.name = name;
        this.keyCode = keyCode;
        this.position = position;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getKeyCode() {
        return keyCode;
    }

    public void setKeyCode(int keyCode) {
        this.keyCode = keyCode;
    }

    public Position getPosition() {
        return position;
    }

    public void setPosition(Position position) {
        this.position = position;
    }
    
    public TextureResource getPressedResource() {
        return pressedResource;
    }
    
    public void setPressedResource(TextureResource pressedResource) {
        this.pressedResource = pressedResource;
    }
    
    public TextureResource getReleasedResource() {
        return releasedResource;
    }
    
    public void setReleasedResource(TextureResource releasedResource) {
        this.releasedResource = releasedResource;
    }

    public float getWidth() {
        return width;
    }

    public void setWidth(float width) {
        this.width = width;
    }

    public float getHeight() {
        return height;
    }

    public void setHeight(float height) {
        this.height = height;
    }
}